TextComponentName Property Details

The TextComponentName property in RapidSpellWebLauncher is designed to accept identifying strings to identify text controls (or html elements) in a multitude of ways (it automatically detects the method used), it is important to understand how it works if you plan to set this property beyond simply the Control ID of the text box.

There are 3 ways to set this property;

1. Control ID - the simplest way is to set this property to the server-side ID of the control to be spell checked. This comes with a caveat; because server-side Control IDs need only be unique with-in a 'naming container' (eg. page, DataList, DataGrid) and because the Control must be found via the FindControl method (which searches the naming container that the RapidSpellWebLauncher control is in) it is only possible to use the Control ID to specify the text box if the text box Control and the RapidSpellWebLauncher are in the same naming container.

2. Control ClientID - setting the TextComponentName to the ClientID of the text control is a good way to firmly identify the text Control to be spell checked. To do this it is usually best to set the TextComponentName property in code-behind or with a data-bind using the ClientID of the text Control.
eg.

rapidSpellWebLauncher.TextComponentName = textBox1.ClientID

This method can also be used when referring to traditional Html elements (such as <textarea> or <input type=text>), in this case the ID attribute of the tag is used to identify the element.
eg.

<textarea ID="textbox1">This is my text box</textarea>
.....
rapidSpellWebLauncher.TextComponentName = "textbox1"

The only warning with this method is to remember (as per good asp.net practice) that the ClientID property of a control is not properly defined until run-time (when the page loads in the browser), therefore the TextComponentName property should be set at run-time, also.

3. Javascript formName.textBoxName - traditionally in client side coding the . style was used to identify form elements.
eg.

<form name="mainForm">
<textarea name="textbox1"></textarea>
</form>
.....
TextComponentName = "mainForm.textbox1"

This method can still be used with RapidSpell Web, however in more complex cases (unusual Control IDs, DataGrids etc) it can be hardest to use.

Note: if the 'Custom' Javascript interface is being used for a text box interface then the tbElementName argument in RSCustomInterface(tbElementName) will be set according to the method used to identify the text box, as detailed below for each method;

1. Control ID - tbElementName will be set to the ClientID of the Control given by TextComponentName.
2. Control ClientID - tbElementName will be set to TextComponentName.
3. Javascript formName.textBoxName - tbElementName will be set to TextComponentName.